From: Sebastian Keller Date: Wed, 21 Jan 2026 21:54:39 +0000 (+0100) Subject: main: Only call gjs_dumpstack() on warnings from main thread X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2^2^2^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=617eceb26a9c292e9d7ef580c7a7041e72d30daf;p=gnome-shell.git main: Only call gjs_dumpstack() on warnings from main thread The mozjs code called by gjs_dumpstack() does not appear to be thread safe and was sometimes resulting in crashes when triggered by error messages from threads other than the main thread. And even when not crashing, such a backtrace can only be misleading since only the main thread is executing JS code. Part-of: (cherry picked from commit 23e3e7970f1ef316c0a5bce2dea4872cf1ca5750) Origin: upstream, 49.4, commit:c481543906d4f843f8aec26029a760ab82e213ef Gbp-Pq: Name main-Only-call-gjs_dumpstack-on-warnings-from-main-thread.patch --- diff --git a/src/main.c b/src/main.c index 99eca3e3c..62a284b51 100644 --- a/src/main.c +++ b/src/main.c @@ -52,6 +52,7 @@ enum { }; static int _shell_debug; static gboolean _tracked_signals[NSIG] = { 0 }; +static GThread *main_thread; static void shell_dbus_acquire_name (GDBusProxy *bus, @@ -384,7 +385,8 @@ default_log_writer (GLogLevelFlags log_level, if ((_shell_debug & SHELL_DEBUG_BACKTRACE_WARNINGS) && ((log_level & G_LOG_LEVEL_CRITICAL) || - (log_level & G_LOG_LEVEL_WARNING))) + (log_level & G_LOG_LEVEL_WARNING)) && + g_thread_self () == main_thread) { const char *log_domain = NULL; @@ -611,6 +613,8 @@ main (int argc, char **argv) g_setenv ("GJS_DEBUG_OUTPUT", "stderr", TRUE); g_setenv ("GJS_DEBUG_TOPICS", "JS ERROR;JS LOG", TRUE); + main_thread = g_thread_self (); + context = meta_create_context (WM_NAME); meta_context_add_option_entries (context, gnome_shell_options, GETTEXT_PACKAGE);